csr_matrix Derived Type

type, public :: csr_matrix

A sparse matrix stored in compressed sparse row (CSR) format.


Components

Type Visibility Attributes Name Initial
integer(kind=int32), public, allocatable, dimension(:) :: column_indices

An NNZ-element array, where NNZ is the number of non-zero values, containing the column indices of each value.

integer(kind=int32), public, allocatable, dimension(:) :: row_indices

An M+1 element array containing the indices in V an JA at which the requested row starts.

real(kind=real64), public, allocatable, dimension(:) :: values

An NNZ-element array, where NNZ is the number of non-zero values, containing the non-zero values of the matrix.


Type-Bound Procedures

procedure, public :: extract_diagonal => csr_extract_diagonal

  • private subroutine csr_extract_diagonal(a, diag, err)

    Extracts the diagonal from a CSR matrix.

    Arguments

    Type IntentOptional Attributes Name
    class(csr_matrix), intent(in) :: a

    The CSR matrix.

    real(kind=real64), intent(out), dimension(:) :: diag

    The diagonal values.

    class(errors), intent(inout), optional, target :: err

    The error object to be updated.

procedure, public :: get => csr_get_element

  • private function csr_get_element(this, i, j) result(rst)

    Retrieves the element at the specified row and column.

    Arguments

    Type IntentOptional Attributes Name
    class(csr_matrix), intent(in) :: this

    The CSR matrix object.

    integer(kind=int32), intent(in) :: i

    The row index.

    integer(kind=int32), intent(in) :: j

    The column index.

    Return Value real(kind=real64)

    The value at the specified row and column.